package com.javachmapi.controller;

import com.javachmapi.dao.IAccountDao;
import com.javachmapi.service.IAccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 模拟一个表现层，用于调用业务层
 */
public class MyController {

    public static void main(String[] args) {
        //1.获取Spring核心容器对象,加载xml
        ApplicationContext cxac = new ClassPathXmlApplicationContext("bean.xml");
        IAccountService accountService = (IAccountService) cxac.getBean("accountService");
        IAccountDao accountDao = cxac.getBean("accountDao",IAccountDao.class);
        System.out.println(accountService);
        System.out.println(accountDao);
        accountService.saveAccount();
    }

}
